<%@ page language="java" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 
<%@ taglib uri="/WEB-INF/webflow.tld" prefix="webflow" %> 
<%@ taglib uri="/WEB-INF/webform.tld" prefix="webform" %> 

<%@ page import="com.broadvision.bpmapp.docreview.Document" %>

<html>
<head>
	<title><bean:message bundle="appCommonRes" key="dr.review.title"/></title>
</head>

<body>
	
<script language="javascript">

function prepareSubmit(val) {
    if ( document.reviewForm.comments.value.length > 2000 ) {
      alert('<bean:message bundle="appCommonRes" key="dr.error.comments"/>');
      return;
    }
    document.reviewForm.formAction.value = val;
    document.reviewForm.submit();
}

</script>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="100%">
<div class="app_pageTitle"><bean:message bundle="appCommonRes" key="dr.review.title"/></div> 

<jsp:useBean id="uploadView" scope="request" type="com.broadvision.web.util.ViewDynaBean"/> 
<bean:define id="doc0" name="uploadView" property="documentList[0]" />
<bean:define id="docType" name="doc0" property="docType" />
	
<!-- review is file document -->
<logic:equal name="docType" value="0">
<jsp:include page="fileList.jsp" flush="true" />
</logic:equal>

<!-- review is microsite document -->
<logic:equal name="docType" value="2">
<jsp:include page="../../ep/microsite/msDocList.jsp" flush="true" />
</logic:equal>

<div class="app_pageSubtitle">
  <span class="left"><bean:message bundle="appCommonRes" key="dr.comment"/></span>
  <span class="right">&nbsp;</span>
</div>

<div class="blockWrap">
<webflow:encode url="/review.do" id="submitURL"/>
<%String url = (String)pageContext.getAttribute("submitURL");%>
<html:form action="<%=url%>">
<input type="hidden" name="formAction" value="add" />
<webform:hidden url="<%=url%>" />

<table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle="appCommonRes" key="dr.commentInfo"/>">

<!-- review is file document -->
<logic:equal name="docType" value="0">
<tr> 
  <td class="label" width="20%"><bean:message bundle="appCommonRes" key="dr.document"/>:</td>
  <td class="labelField" width="80%">
  	<select name="docOID">
    <logic:iterate id="doc" name="uploadView" property="documentList" indexId="index">
    <option value="<bean:write name="doc" property="docOID"/>"><bean:write name="doc" property="docName"/></option>	
    </logic:iterate>
  	</select>
  </td>
</tr>
</logic:equal> 

<!-- review is microsite document -->
<logic:equal name="docType" value="2">
  <logic:iterate id="doc" name="uploadView" property="documentList" indexId="index">
    <html:hidden name="doc" property="docOID"/>
  </logic:iterate>
</logic:equal>

<tr> 
  <td class="label" width="20%"><bean:message bundle="appCommonRes" key="dr.commentItemNumber"/>:</td>
  <td class="labelField" width="80%"><input type="text" name="commentItemNum" size="40" maxlength="80" /></td>
</tr>

<tr> 
  <td class="label" width="20%"><bean:message bundle="appCommonRes" key="dr.category"/>:</td>
  <td class="labelField" width="80%"><input type="text" name="category" size="40" maxlength="80" /></td>
</tr>

<tr> 
  <td class="label" width="20%"><bean:message bundle="appCommonRes" key="dr.pageNumber"/>:</td>
  <td class="labelField" width="80%"><input type="text" name="pageNum" size="40" maxlength="80" /></td>
</tr>

<tr> 
  <td class="label" width="20%"><bean:message bundle="appCommonRes" key="dr.paragraph"/>:</td>
  <td class="labelField" width="80%"><input type="text" name="para" size="40" maxlength="80" /></td>
</tr>

<tr> 
  <td class="label" width="20%"><bean:message bundle="appCommonRes" key="dr.comment"/>:</td>
  <td class="labelField" width="80%"><textarea name="comments" cols="40" rows="5"></textarea></td>
</tr>

<tr> 
  <td class="label" width="20%"><bean:message bundle="appCommonRes" key="dr.crossRef"/>:</td>
  <td class="labelField" width="80%"><input type="text" name="crossRef" size="40" maxlength="80" /></td>
</tr>

</table>

<div class="pageButtonWrap" align="right">
<input hspace="40" type="button" name="Submit" class="pageButton" value="<bean:message bundle="appCommonRes" key="dr.moreComment"/>" 
	onClick="javascript:prepareSubmit('more')">
<input hspace="40" type="button" name="Submit" class="pageButton" value="<bean:message bundle="appCommonRes" key="dr.finish"/>" 
	onClick="javascript:prepareSubmit('done')">
</div>

</html:form>
</div>
</td>
</tr>
</table>

</body>
</html>
